package cn.broadsense.web.controller.body;

import cn.broadsense.common.interfaces.ValidationGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("短信登录数据")
public class SmsBody implements Serializable {

    @ApiModelProperty("手机号码")
    @NotBlank(message = "请填写手机号码", groups = {ValidationGroup.Insert.class, ValidationGroup.Query.class})
    @Length(min = 11, max = 11, message = "手机号只能为11位", groups = {ValidationGroup.Insert.class, ValidationGroup.Query.class})
    @Pattern(regexp = "^[1][3,4,5,6,7,8,9][0-9]{9}$", message = "手机号码格式有误", groups = {ValidationGroup.Insert.class, ValidationGroup.Query.class})
    private String phonenumber;

    @ApiModelProperty("短信验证码，登录的时候需要填写")
    @NotBlank(message = "请填写短信验证码", groups = {ValidationGroup.Insert.class})
    private String captcha;
}
